package com.medical.doctor.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.medical.doctor.entity.DoctorHospitalEntity;
import com.medical.doctor.service.DoctorHospitalService;
import com.medical.common.utils.PageUtils;
import com.medical.common.utils.R;



/**
 * 
 *
 * @author wen
 * @email 1023076426@qq.com
 * @date 2021-08-13 20:09:06
 */
@RestController
@RequestMapping("doctor/doctorhospital")
public class DoctorHospitalController {
    @Autowired
    private DoctorHospitalService doctorHospitalService;


    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = doctorHospitalService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{hospitalId}")
    public R info(@PathVariable("hospitalId") Integer hospitalId){
		DoctorHospitalEntity doctorHospital = doctorHospitalService.getById(hospitalId);

        return R.ok().put("doctorHospital", doctorHospital);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody DoctorHospitalEntity doctorHospital){
		doctorHospitalService.save(doctorHospital);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody DoctorHospitalEntity doctorHospital){
		doctorHospitalService.updateById(doctorHospital);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] hospitalIds){
		doctorHospitalService.removeByIds(Arrays.asList(hospitalIds));

        return R.ok();
    }

}
